<template>
  <div>test

    <a href="http://www1.pconline.com.cn/20200125/guangzhou/lixnhao/asdfajk/test/pdf.pdf" download="pdf">123</a>
  </div>
</template>

<script>
export default {
  data() {
    return {}
  },
  created() {},
  mounted() {
    this.loadPdf()
  },
  methods: {
    testPdf() {

    },
    loadPdf(url) {
      // const srcipt = document.createElement('script')
      // srcipt.src = 'http://www1.pconline.com.cn/20200125/guangzhou/lixnhao/asdfajk/test/pdf.pdf'
      // srcipt.async = false

      // document.body.append(srcipt)
      // srcipt.onload = function(...res) {
      //   console.log('res', res, this)
      // }
      // return Promise((resovle,reject)=>{

      // })
      fetch('https://img.51msyc.com//withdraw/file/20210125/20210125170623932%E6%96%B0%E5%BB%BA%20pptx%20%E6%BC%94%E7%A4%BA%E6%96%87%E7%A8%BF.pdf', {
        referrer: '',
        // referrerPolicy: 'no-referrer',
        mode: 'cors',
        credentials: 'include',

        referrerPolicy: 'strict-origin-when-cross-origin' // same-origin，
        // credentials: 'same-origin' // omit，include
      })
        .then(res => res.blob())
        .then(blob => {
          console.log('blob: ', blob)
          const a = document.createElement('a')
          a.href = URL.createObjectURL(blob)
          a.download = 'test'
          a.content = 'never'
          a.click()
          a.remove()
          URL.revokeObjectURL(a.href)
        })
    }
  }
}
</script>

<style>

</style>template
